<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<head>
    <title th:text="${pageTitle}"></title>
    <div data-th-replace="layout/head-top"></div>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInLeft">
        <div data-th-replace="common/functionDepict"></div>
        <div>
            <div class="row">
                <div class="pt10">
                    <div class="col-sm-7">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>优惠券信息</h5>
                            </div>
                            <div class="ibox-content clearfix p-t">
                                <div class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">优惠券名称</label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static"><span th:text="${coupon['title']}"></span><small class="fs12 c-999"></small></p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">优惠券批次</label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static"><span th:text="${coupon['couponBatch']}"></span><small class="fs12 c-999"></small></p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">优惠券数量</label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static"><span th:text="${coupon['codeNum']}"></span><small class="fs12 c-999">张</small></p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">优惠券类型</label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static">
                                                <span th:if="${coupon['type']}==1">折扣券</span>
                                                <span th:if="${coupon['type']}==2">定额券</span>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">
                                            <span th:if="${coupon['type']}==1">单张优惠券折扣</span>
                                            <span th:if="${coupon['type']}==2">单张优惠券金额</span>
                                        </label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static">
                                                <i class="fa fa-tag" th:if="${coupon['type']}==1"></i>
                                                <i class="fa fa-cny" th:if="${coupon['type']}==2"></i>
                                                <span th:text="${coupon['limitAtion']}"></span>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">获取条件</label>
                                        <div class="col-sm-10">
                                            <p class="form-control-static">
                                                <th:block th:if="${coupon['receiveType']}==1">商品详情领取</th:block>
                                                <th:block th:if="${coupon['receiveType']}==2 and ${coupon['orientType']}==1">
                                                    <th:block th:if="${coupon['userType']}==1">全部用户</th:block>
                                                    <th:block th:if="${coupon['userType']}==2">部分用户</th:block>
                                                </th:block>
                                                <th:block th:if="${coupon['receiveType']}==2 and ${coupon['orientType']}==2">
                                                    <span th:if="${coupon['conditions']}==1">手动发放</span>
                                                    <span th:if="${coupon['conditions']}==2">新用户注册后自动获取</span>
                                                    <span th:if="${coupon['conditions']}==3">学员生日获取</span>
                                                    <span th:if="${coupon['conditions']}==4">邀请注册获取</span>
                                                    <span th:if="${coupon['conditions']}==5">消费任意金额获取</span>
                                                    <span th:if="${coupon['conditions']}==6">免费直播发放</span>
                                                    <span th:if="${coupon['conditions']}==7">活动</span>
                                                </th:block>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group" th:if="${coupon['conditions']}==6">
                                        <label class="col-sm-2 control-label text-right">限定免费直播程</label>
                                        <div class="col-sm-9">
                                            <div class="pt10">
                                                <table class="table table-bordered table-hover">
                                                    <thead>
                                                    <tr>
                                                        <th class="text-center">ID</th>
                                                        <th>课程名称</th>
                                                        <th class="text-center">开放时间</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr th:each="openCourse : ${coupon['openCourseList']}">
                                                        <td class="text-center" th:text="${openCourse['id']}"></td>
                                                        <td th:text="${openCourse['courseName']}"></td>
                                                        <td class="text-center" th:text="${openCourse['realPrice']}"></td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed" th:if="${coupon['conditions']}==6"></div>
                                        <div class="form-group" th:if="${coupon['subjectList']}!=null">
                                            <label class="col-sm-2 control-label">使用条件</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static">限定使用范围-专业/科目：<span class="fs14 c-222" th:each="subject,index : ${coupon['subjectList']}" th:text="${index.index} lt (${#lists.size(coupon['subjectList'])}-1)?${subject.subjectName}+'/': ${subject.subjectName}"></span></p>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed" th:if="${coupon['subjectList']}!=null"></div>
                                        <div class="form-group" th:if="${coupon['courseList']}!=null">
                                            <label class="col-sm-2 control-label text-right">限定课程</label>
                                            <div class="col-sm-9">
                                                <div class="pt10">
                                                    <table class="table table-bordered table-hover">
                                                        <thead>
                                                        <tr>
                                                            <th class="text-center">ID</th>
                                                            <th>课程名称</th>
                                                            <th class="text-center">价格</th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr th:each="course : ${coupon['courseList']}">
                                                                <td class="text-center" th:text="${course['id']}"></td>
                                                                <td th:text="${course['courseName']}"></td>
                                                                <td class="text-center" th:text="${course['realPrice']}"></td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                        <div th:if="${coupon['courseList']}!=null"  class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">限定消费金额</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static"><i class="fa fa-cny"></i> <span th:text="${coupon['minAmount']}"></span></p>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group" th:if="${coupon['timeType']}==1">
                                            <label class="col-sm-2 control-label">使用时间</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static" th:text="${coupon['beginTime']}+'—'+${coupon['endTime']}">
                                                </p>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed" th:if="${coupon['timeType']}==1"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">优惠券备注</label>
                                            <div class="col-sm-10">
                                                <p class="form-control-static" th:text="${coupon['summary']}"><small class="fs12 c-999"></small></p>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-10 col-sm-offset-2">
                                                <button class="btn btn-primary ml10" id="back" type="button">返回列表</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-5">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <div class="pull-right" style="margin-top: -19px">
                                    <form id="search-form" name="search-form"  class="form-inline search-form" action="">
                                        <input type="hidden" name="couponId" th:value="${coupon['id']}"/>
                                    <select class="form-control vam" name="status" >
                                        <option value="">优惠券状态</option>
                                        <option value="1">未使用</option>
                                        <option value="2">已冻结</option>
                                        <option value="4">已做废</option>
                                        <option value="5">已使用</option>
                                        <option value="6">已停止</option>
                                    </select>
                                        <div class="form-group">
                                            <input placeholder="使用时间" id="beginUseTime" name="beginUseTime"
                                                   class="laydate-icon form-control layer-date" type="text">
                                            -
                                            <input placeholder="使用时间" id="endUseTime" name="endUseTime"
                                                   class="laydate-icon form-control layer-date" type="text">
                                        </div>
                                    <button type="button" id="submitCouponCode" class="btn btn-sm btn-primary vam" style="margin: 0">搜索</button>
                                    </form>
                                </div>
                            </div>
                            <div class="ibox-content">
                                <div class="well">
                                    <div class="row">
                                    <span class="col-sm-8">共 <small class="c-master" id="totalNum" th:text="${coupon['codeNum']}"></small> 张优惠券 ，使用 <small class="c-green" th:text="${coupon['useCount']}">0</small> 张，停止/做废 <small class="c-red" th:text="${coupon['invalidCount']}">0</small> 张，未使用 <small class="text-999" th:text="${coupon['codeNum']}-${coupon['useCount']}-${coupon['invalidCount']}">0</small> 张</span>
                                    <a class="col-sm-4" href="javascript:void(0)" id="downloadExcel">
                                        <button class="btn  btn-w-m btn-primary" type="button">
                                            <i class="fa fa-download"></i> 导出数据
                                        </button>
                                    </a>
                                    </div>
                                </div>
                            </div>
                               <div id="couponCode-list-context">

                               </div>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
    </div>
    </div>
    <div data-th-replace="layout/head-footer"></div>
    <script type="text/javascript"
            th:src="@{{path}/admin/libs/plugins/layer/laydate/laydate.js?v={v}(path=${staticPath},v=${v})}"></script>
    <script type="text/javascript" th:src="@{{path}/admin/business/op/coupon/coupon_code_ajax_list.js?v={v}(path=${staticPath},v=${v})}"> </script>
    <script type="text/javascript" th:src="@{{path}/admin/business/common/exportExecl.js?v={v}(path=${staticPath},v=${v})}"></script>
</body>
</html>
